********************************************************************************
	
set more off 
clear
capture log close
log using "Updated Table 2", replace 

********************************************************************************

*     ***************************************************************** *;
*     ***************************************************************** *;
*       File-Name:      updatedtable2.do                                *;
*       Date:           3/31/18                                         *;
*       Author:         YN                                              *;
*       Purpose:        Do-file for updating table 2 in "FDI,           *;
*                       Poverty, and Access to Potable Water in         *;
*						Developing Countries Paper                      *;
*       Input File:     India_timeseries_final _with ipolate.dta        *;
*       Output File:    Updated Table 2.log                             *;
*       Data Output:    LaTeX                                           *;
*       Previous file:  Access to Water_ all models.do                  *;
*       Machine:        Mac                                             *;
*     ****************************************************************  *;
*     ****************************************************************  *;

 use "India_timeseries_final _with ipolate and sv.dta"

*%Sub-sector FDI Models
*Manufacturing
xi: xtpcse  _growthhhldwithaccesstowater _manufacturingreliable_gdp _i2percentageofscst  _diiiiasageofgdpallinclusiverscr, pairwise corr (psar1)
	eststo c1
xi: xtpcse _growthhhldwithaccesstowater  _popgrowth _lnurban _lnpercapitagdpcurrent19992000  _manufacturingreliable_gdp _i2percentageofscst _manufac_fdi_gdp_i2percentscst _growthgsdpatcurrentprices _diiiiasageofgdpallinclusiverscr _lngross_cropped_area excess_rainfall_20pct i.id i.year, pairwise corr(psar1)
	eststo c2
*Services (non-water intensive)
xi: xtpcse  _growthhhldwithaccesstowater _servicesreliablefdi_gdp _i2percentageofscst  _diiiiasageofgdpallinclusiverscr, pairwise corr (psar1)
	eststo c7
xi: xtpcse _growthhhldwithaccesstowater  _popgrowth _lnurban _lnpercapitagdpcurrent19992000  _servicesreliablefdi_gdp _i2percentageofscst _services_fdi_gdp_i2percentscst _growthgsdpatcurrentprices _diiiiasageofgdpallinclusiverscr _lngross_cropped_area excess_rainfall_20pct i.id dummy19962000 dummy20012004, pairwise corr(psar1)
	eststo c8
*Textiles
xi: xtpcse  _growthhhldwithaccesstowater _textilesreliable_gdp _i2percentageofscst  _diiiiasageofgdpallinclusiverscr, pairwise corr (psar1)
	eststo c3
xi: xtpcse _growthhhldwithaccesstowater  _popgrowth _lnurban _lnpercapitagdpcurrent19992000  _textilesreliable_gdp _i2percentageofscst _textile_fdi_gdp_i2percentscst _growthgsdpatcurrentprices _diiiiasageofgdpallinclusiverscr _lngross_cropped_area excess_rainfall_20pct i.id dummy19962000 dummy20052009, pairwise corr(psar1)
	eststo c4
 *water-intensive FDI
replace water1= (_electricalmachineryreliable_gdp + _chemicalsreliable_gdp + _fbreliable_gdp)

xi: xtpcse _growthhhldwithaccesstowater _popgrowth _lnurban _lnpercapitagdpcurrent19992000  _water1 _i2percentageofscst  _water1i2percentageofscst  _growthgsdpatcurrentprices _diiiiasageofgdpallinclusiverscr i.id dummy19962000 dummy20052009, pairwise corr(psar1)
	eststo c5
xi: xtpcse _growthhhldwithaccesstowater  _popgrowth _lnurban _lnpercapitagdpcurrent19992000  _water1 _i2percentageofscst  _water1i2percentageofscst _growthgsdpatcurrentprices _diiiiasageofgdpallinclusiverscr _lngross_cropped_area excess_rainfall_20pct i.id dummy19962000 dummy20052009, pairwise corr(psar1)
	eststo c6
 


estout c1 c2 c3 c4 c5 c6 c7 c8 ///
				using "RA_Updated_Table_2.txt", replace label delimiter(_tab) noabbrev ///
				cells(b(star fmt(%9.4f)) p(par abs fmt(3))) style(fixed) starlevels(* 0.10 ** 0.05 *** 0.01) ///
				stats(N r2, labels("N" "R-squared") ///
				fmt(0 2)) order( _popgrowth _lnurban _lnpercapitagdpcurrent19992000 ///
				_i2percentageofscst _l2fdigdpreliablei2percentscst ///
				_growthgsdpatcurrentprices _diiiiasageofgdpallinclusiverscr ///
				_lngross_cropped_area excess_rainfall_20pct ) ///
				mlabels("(1)" "(2)" "(1)" "(2)" "(1)" "(2)" "(1)" "(2)")
				

			

